package no.uib.hplims.views.auth;

import no.uib.hplims.MyVaadinApplication;
import no.uib.hplims.tools.Icons;
import no.uib.hplims.views.AbstractParentTab;

import org.vaadin.appfoundation.authentication.SessionHandler;

public class Logout extends AbstractParentTab {

	private static final long serialVersionUID = 7463144829029645935L;
	
	private static String caption = "Sign out";

	public Logout() {
		super(caption, Icons.cancelIcon16);
		
		init();
	}

	@Override
	protected void init() {
		
	}
	
	@Override
	public String toString() {
		return caption;
	}

	public void activated(Object... params) {
		System.out.println("Activated logout");
		// Log out user
		SessionHandler.logout();
		// Close app and session. Reloads a new instance of 
		// the application
		MyVaadinApplication.getInstance().close();
		
	}

	public void deactivated(Object... params) {
		// TODO Auto-generated method stub
		
	}

	

}
